<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js" ></script>
<script type="text/javascript">
	function validateProductName(){
		$.post("/uniqueProductName",{"name": $("#productName").val()},function(data){
			if(data.contains	== "1"){
				$("#callback").html("该产品名已经被使用")
				$("#submit").attr('disabled',"true")
			}else if(data.contains == "0"	){
				$("#callback").html("该产品名可以使用")
				$("#submit").removeAttr("disabled");
			}
		})
	}
</script>
</head>
<body>
	创建产品<br/>
	<form action="/configInsurance">
		产品名称<input type="text" name="productName" id='productName'  onchange="validateProductName()"/> <span id="callback"></span><br>
		产品描述<input type="text" name="productDesc"/>
		
		<input type="hidden" name="status" value="1"/>
		
		<input type="submit" id="submit" disabled=true/>
	</form>
	
	
</body>
</html>